import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;

import java.util.function.Supplier;

/**
 * @author understand
 * @description:
 * @create 2025/5/23 17:47
 */
@AllArgsConstructor
@Data
@NoArgsConstructor
public class Car {
    //Supplier是jdk1.8的接口，这里和lamda一起使用了
    private String name;
    public static Car create( Supplier<Car> supplier) {
        return supplier.get();
    }

    public static void collide(final Car car) {
        System.out.println("Collided " + car.toString());
    }

    public  void follow( Car another) {
        System.out.println("Following the " + another.toString());
    }

    public void repair() {
        System.out.println("Repaired " + this.toString());
    }
}
